#ifndef SCENE_ITEM_H
#define SCENE_ITEM_H
#include <qobject.h>
#include <qvector3d.h>
#include "renderable.h"

class SceneItem : public QObject
{
	Q_OBJECT
	Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
	Q_PROPERTY(double minDistance READ getVisibleMinDistance WRITE setVisibleMinDistance)
	Q_PROPERTY(double maxDistance READ getVisibleMaxDistance WRITE setVisibleMaxDistance)
    Q_PROPERTY(double scale READ getScale WRITE setScale NOTIFY scaleChanged)
    Q_PROPERTY(QVector3D geoPosition READ getGeoPosition WRITE setGeoPosition)	
public:
    SceneItem(QObject* parent = nullptr);
    virtual ~SceneItem();
public:
    virtual bool loadFromBuffer(const QByteArray& buffer);
    virtual QByteArray& toBuffer()const;
	QString getUid()const;
public:
	virtual void setVisibleMinDistance(double distance);
	virtual void setVisibleMaxDistance(double distance);
	void setVisibleDistanceRange(double minDistance,double maxDistance);
	
	double getVisibleMinDistance()const;
	double getVisibleMaxDistance()const;
public:
    void setHeight(double height);
	double getHeight()const;
	
    void setGeoPosition(double lon,double lat,double height);
	virtual void setGeoPosition(const QVector3D& pos);
	QVector3D getGeoPosition()const;

    virtual void setHeading(double heading);
    double getHeading()const;

    virtual void setPitch(double pitch);
    double getPitch()const;

    virtual void setRoll(double roll);
    double getRoll()const;

    void setHPR(double heading,double pitch,double roll);
    virtual void setHPR(const QVector3D& hpr);
    QVector3D getHPR()const;

    virtual void setScale(double scale);
    double getScale()const;	
	
	virtual double getDefaultScale()const;
signals:
    void visibleChanged(bool visible);
	void geoPositionChanged(const QVector3D& position);
    void scaleChanged(double scale);
    void headingChanged(double heading);
    void pitchChanged(double pitch);
    void rollChanged(double roll);	
};

#endif